package com.farecrawler.app.controllers;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.farecrawler.app.main.FareCrawlMain;

@Controller
@RequestMapping("/startcrawl")
public class FareCrawlerController{
	
	@Resource(name="fareCrawlMain")
	private FareCrawlMain fareCrawlMain;
	
	@RequestMapping(method = RequestMethod.GET)
	public String hello(HttpServletRequest req, ModelMap model) {
		
		fareCrawlMain.start();
		
		model.addAttribute("message", "we are in results");
		return "output/farecrawlresults";
	}
	
	/*
	 * Getters Setters
	 */
	public FareCrawlMain getFareCrawlMain() {
		return fareCrawlMain;
	}

	public void setFareCrawlMain(FareCrawlMain fareCrawlMain) {
		this.fareCrawlMain = fareCrawlMain;
	}

}
